function res = getKPrecision( est, gt )

n = size(est, 1);
m = size(est, 2);

res = zeros( 1, m );
%res_r = zeros( 1, m );

for i = 1:n
    value  = sort( est(i,:) ) + 1e-5;
    value_gt = sort( gt(i,:) ) + 1e-5;
    for k = 1:m
        bo_est = (est(i,:)<value(k));        
        bo_gt = (gt(i,:)<value_gt(k));        
        bo = bo_est.* bo_gt;
        res(k) = res(k) + sum(bo)/k;
    end    
end

res = res/n;

% res_p = res_p / n
% res_r = res_r / n
% res = res_p .* res_r * 2 ./( res_p + res_r );